#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main(void)
{
	char a[18];
	int b[17];
	int i, r;

	i = 0;
	for (i = 0;i < 17;i++) {
		a[i] = getchar();
	}
	for (i = 0;i < 18;i++) {
		b[i] = a[i] - 48;
	}
	r = (b[0] * 7 + b[1] * 9 + b[2] * 10 + b[3] * 5 + b[4] * 8 + b[5] * 4 + b[6] * 2 + b[7] + b[8] * 6 + b[9] * 3 + b[10] * 7 + b[11] * 9 + b[12] * 10 + b[13] * 5 + b[14] * 8 + b[15] * 4 + b[16] * 2) % 11;
	if (r == 2) {
		printf("X");
	}
	else if (r >= 3 && r <= 9) {
		printf("%d", 12 - r);
	}
	else if (r == 10) {
		printf("2");
	}
	else if (r == 0) {
		printf("1");
	}
	else if (r == 1) {
		printf("0");
	}

	return 0;
}
#include<stdio.h>
#include<string.h>
int main()
{
	char a[20][30], * r, * t[20];
	int n, i = 0, m, k, c;
	scanf("%d", &n);
	getchar();
	while (i < n) {
		gets(a[i]);
		t[i] = a[i];
		i++;
	}
	for (m = 0;m < n - 1;m++) {
		k = m;
		for (c = m + 1;c < n;c++) {
			if (strcmp(t[k], t[c]) > 0) {
				k = c;
			}
		}
		r = t[m];
		t[m] = t[k];
		t[k] = r;
	}
	for (int c = 0;c < n;c++) {
		puts(t[c]);
	}
	return 0;
}
#include<stdio.h>
int main(void)
{
	char b[10];
	int a[11] = { 29,23,19,17,13,11,7,5,3,2,1 }, sum = 0;
	scanf("%s", b);
	int flag = 0, n;

	for (int i = 0;i <= 9;i++)
	{
		sum += a[i] * (b[i] - 48);
	}

	for (n = 0;n <= 9;n++)
	{
		if ((sum + n) % 11 == 0)
		{
			printf("%d", n);
			flag = 1;
		}
	}

	if (flag == 0)
	{
		printf("X");
	}
}
#include<stdio.h>
#include<string.h>
int main()
{
	char a[1000];
	gets(a);
	for (int q = strlen(a) - 1;q >= 0;q--) {
		printf("%c", a[q]);
	}
	return 0;
}
#include<stdio.h>
#include <string.h> 
int main(void)
{
	int sum = 0;
	char a[100];
	gets(a);
	int n = strlen(a);
	for (int i = 0;i < n;i++) {
		sum = sum * 2 + (a[i] - '0');
	}
	printf("%d", sum);
	return 0;
}
#include<stdio.h>
int main(void)
{
	char c;
	int a[18], i;

	for (i = 0;i < 18;i++) {
		scanf("%c", &c);
		a[i] = c - '0';
	}
	if (a[16] % 2 != 0) {
		for (i = 6;i < 14;i++) {
			printf("%d", a[i]);
		}
		printf(" male");
	}
	else {
		for (i = 6;i < 14;i++) {
			printf("%d", a[i]);
		}
		printf(" female");
	}
	return 0;
}
#include<stdio.h>
int main()
{
	int a, b, c, d;
	d = 0;
	scanf("%d", &a);
	c = a;
	while (a > 0) {
		b = a % 10;
		d = d * 10 + b;
		a /= 10;
	} if (d == c && c >= 10) {
		printf("Y");
	}
	else {
		printf("N");
	}
	return 0;
}
